<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />    
<title>GB2UTF-8</title>
<style type="text/css">
<!--
.bicyle {
font-family: "Times New Roman", "Times", "serif";
font-size: 12px;
background-color: #FFFFFF;
}
-->
</style>
<link href="css/jquery.autocomplete.css" type=text/css rel=stylesheet>
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript" src="js/jquery.autocomplete.js"></script>
<script type="text/javascript">
$().ready(function() {
	function formatItem(row) {
		return " <p>"+row[0] +" </p>"+ " <span>" + row[1] + "xp</span>";
	}
	function formatResult(row) {
		return row[0].replace(/(<.+?>)/gi, '');
	}
	function selectItem(li) {
		makeSearchUrl(document.formkeyword);
	}
	$("#keyword").autocomplete("error.gsp",
	{
		delay:10,
		matchSubset:1,
		matchContains:1,
		cacheLength:10,
		onItemSelect:selectItem,
		formatItem: formatItem,
		formatResult: formatResult
	}
	);

});
</script>
</head>
<body>
<script type="text/javascript">
 var makeSearchUrl = function(o){
	var keys = o.keyword.value;
	if(keys == "" || keys == "请输入关键字"){
		alert("请输入关键字");
		o.keyword.focus();
		return false;
	}
	keys = encodeURIComponent(keys);
	var url = "/article-search-keyword-"+ keys+".html";
	window.open(url,'_self');
	return false;
}
</script>
<div align=center>
<center>
    <table border=0 cellpadding=0 cellspacing=0 style="border-collapse: collapse" width=90% id=bicyle height=52>
      <tr>
        <td width=100% height=13> <p align=center class="bicyle"><font color=#FF0000 size=3 face=Arial, Helvetica, sans-serif><strong>UTF-8
            <br>
            </strong></font></p>
          </td>
      </tr>
      <tr>
        <td height=6><div align="center">
            <textarea name="textarea" cols=82 rows=10 id=code></textarea>
          </div></td>
      </tr>
      <tr>
        <td height=7><div align="center">
            <input name="button" type=button onClick=encode(code,this) value=GB2UTF>
            <script>
var mode="zhuan";
function encode(obj,btn){
    if(mode=="zhuan"){
        obj.value=obj.value.replace(/[^\u0000-\u00FF]/g,function($0){return escape($0).replace(/(%u)(\w{4})/gi,"&#x$2;")});
        btn.value="UTF2GB";
        mode="huan";
    }else{
        obj.value=unescape(obj.value.replace(/&#x/g,'%u').replace(/;/g,''));
        btn.value="GB2UTF";
        mode="zhuan";
    }
}
</script>
          </div></td>
      </tr>
    </table>
</center>
</div>
<div class="sidebarBlock">
<h5>Search</h5>
<form id="formkeyword" name="formkeyword" method="get" action="search.html" onsubmit="return makeSearchUrl(this)">
<div class="sidebarSearch">
<ul>
<li><input type="text" name="keyword" size="24" maxlength="255" value="" id="keyword" class="text"/></li>
<li><input type="submit" value="search" class="button"/></li>
</ul>
</div>
</form>
</div>
</body>
</html>
